/*
 * @Author: ReinerLau lk850593913@gmail.com
 * @Date: 2022-09-26 16:21:40
 * @LastEditors: ReinerLau lk850593913@gmail.com
 * @LastEditTime: 2022-09-26 16:25:00
 * @FilePath: \robot\src\api\signaling.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import axios from "axios";

const service = axios.create({
  baseURL: import.meta.env.VITE_SIGNALING_API,
});

/**
 * @description: 获取远端串流编码信息
 * @param {*} params 请求参数
 * @return {*}
 */
export function getCodecInfo(path, params) {
  return service({
    url: `/codec/${path}`,
    method: "get",
    params,
  });
}

/**
 * @description: 获取远端answer
 * @param {*} params 请求参数
 * @return {*}
 */
export function getRemoteSdp(path, params) {
  const formData = new FormData();
  const { suuid, data } = params;
  formData.append("suuid", suuid);
  formData.append("data", data);
  return service({
    url: `/receiver/${path}`,
    method: "post",
    data: formData,
  });
}
